home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / accctrl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  8.7 KB  |  239 lines

  1. //+-------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1993-1996.
  5. //
  6. //  File:        accctrl.h
  7. //
  8. //  Contents:    common internal includes for
  9. //
  10. //  History:     8-94        Created         DaveMont
  11. //
  12. //--------------------------------------------------------------------
  13.  
  14. /*
  15.  *      C/C++ Run Time Library - Version 9.0
  16.  *
  17.  *      Copyright (c) 1997, 1998 by Borland International
  18.  *      All Rights Reserved.
  19.  *
  20.  */
  21.  
  22. #ifndef __ACCESS_CONTROL__
  23. #define __ACCESS_CONTROL__
  24. #pragma option push -b
  25.  
  26. #define AccFree LocalFree
  27. //--------------------------------------------------------------------
  28. //
  29. // NT specific access request structure definition
  30. //
  31. //--------------------------------------------------------------------
  32.  
  33. //
  34. // Definition: TRUSTEE_TYPE
  35. // This enumerated type specifies the type of trustee account for the trustee
  36. // returned by the API described in this document.
  37. // TRUSTEE_IS_UNKNOWN - The trustee is an unknown, but not necessarily invalid
  38. //                      type.  This field is not validated on input to the APIs
  39. //                      that take Trustees.
  40. // TRUSTEE_IS_USER      The trustee account is a user account.
  41. // TRUSTEE_IS_GROUP     The trustee account is a group account.
  42. //
  43. typedef enum _TRUSTEE_TYPE
  44. {
  45.     TRUSTEE_IS_UNKNOWN,
  46.     TRUSTEE_IS_USER,
  47.     TRUSTEE_IS_GROUP,
  48. } TRUSTEE_TYPE;
  49.  
  50.  
  51. //
  52. // Definition: TRUSTEE_FORM
  53. // This enumerated type specifies the form the trustee identifier is in for a
  54. // particular trustee.
  55. // TRUSTEE_IS_SID       The trustee is identified with a SID rather than with a name.
  56. // TRUSTEE_IS_NAME      The trustee is identified with a name.
  57. //
  58. typedef enum _TRUSTEE_FORM
  59. {
  60.     TRUSTEE_IS_SID,
  61.     TRUSTEE_IS_NAME,
  62. } TRUSTEE_FORM;
  63.  
  64.  
  65. //
  66. // Definition: MULTIPLE_TRUSTEE_OPERATION
  67. // If the trustee is a multiple trustee, this enumerated type specifies the type.
  68. // TRUSTEE_IS_IMPERSONATE       The trustee is an impersonate trustee and the multiple
  69. //                          trustee field in the trustee points to another trustee
  70. //                          that is a trustee for the server that will be doing the
  71. //                          impersonation.
  72. //
  73. typedef enum _MULTIPLE_TRUSTEE_OPERATION
  74. {
  75.     NO_MULTIPLE_TRUSTEE,
  76.     TRUSTEE_IS_IMPERSONATE,
  77. } MULTIPLE_TRUSTEE_OPERATION;
  78.  
  79.  
  80. //
  81. // Definition: TRUSTEE
  82. // This structure is used to pass account information into and out of the system
  83. // using the API defined in this document.
  84. // PMultipleTrustee     - if NON-NULL, points to another trustee structure, as
  85. //                    defined by the multiple trustee operation field.
  86. // MultipleTrusteeOperation - Defines the multiple trustee operation/type.
  87. // TrusteeForm - defines if the trustee is defined by name or SID.
  88. // TrusteeType - defines if the trustee type is unknown, a user or a group.
  89. // PwcsName     - points to the trustee name or the trustee SID.
  90. //
  91. typedef struct _TRUSTEE_A *PTRUSTEE_A;
  92. typedef struct _TRUSTEE_W *PTRUSTEE_W;
  93.  
  94. typedef struct _TRUSTEE_W
  95. {
  96.     PTRUSTEE_W                  pMultipleTrustee;
  97.     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
  98.     TRUSTEE_FORM                TrusteeForm;
  99.     TRUSTEE_TYPE                TrusteeType;
  100.     LPWSTR                      ptstrName;
  101. } TRUSTEE_W;
  102.  
  103. typedef struct _TRUSTEE_A
  104. {
  105.     PTRUSTEE_A                  pMultipleTrustee;
  106.     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
  107.     TRUSTEE_FORM                TrusteeForm;
  108.     TRUSTEE_TYPE                TrusteeType;
  109.     LPSTR                       ptstrName;
  110. } TRUSTEE_A;
  111.  
  112. #ifdef UNICODE
  113.     #define TRUSTEE     TRUSTEE_W
  114.     #define PTRUSTEE    PTRUSTEE_W
  115. #else
  116.     #define TRUSTEE     TRUSTEE_A
  117.     #define PTRUSTEE    PTRUSTEE_A
  118. #endif
  119.  
  120.  
  121. //
  122. // Definition: ACCESS_MODE
  123. // This enumerated type specifies how permissions are (requested)/to be applied
  124. //  for the trustee by the access control entry.  On input this field can by any
  125. //  of the values, although it is not meaningful to mix access control and audit
  126. //  control entries.  On output this field will be either SET_ACCESS, DENY_ACCESS,
  127. // SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE.
  128. // The following descriptions define how this type effects an explicit access
  129. // request to apply access permissions to an object.
  130. // GRANT_ACCESS - The trustee will have at least the requested permissions upon
  131. //                successful completion of the command. (If the trustee has
  132. //                additional permissions they will not be removed).
  133. // SET_ACCESS - The trustee will have exactly the requested permissions upon
  134. //              successful completion of the command.
  135. // DENY_ACCESS - The trustee will be denied the specified permissions.
  136. // REVOKE_ACCESS - Any explicit access rights the trustee has will be revoked.
  137. // SET_AUDIT_SUCCESS - The trustee will be audited for successful opens of the
  138. //                     object using the requested permissions.
  139. // SET_AUDIT_FAILURE - The trustee will be audited for failed opens of the object
  140. //                     using the requested permissions.
  141. //
  142. typedef enum _ACCESS_MODE
  143. {
  144.     NOT_USED_ACCESS = 0,
  145.     GRANT_ACCESS,
  146.     SET_ACCESS,
  147.     DENY_ACCESS,
  148.     REVOKE_ACCESS,
  149.     SET_AUDIT_SUCCESS,
  150.     SET_AUDIT_FAILURE
  151. } ACCESS_MODE;
  152.  
  153. //
  154. // Definition: Inheritance flags
  155. // These bit masks are provided to allow simple application of inheritance in
  156. // explicit access requests on containers.
  157. // NO_INHERITANCE       The specific access permissions will only be applied to
  158. //                  the container, and will not be inherited by objects created
  159. //                  within the container.
  160. // SUB_CONTAINERS_ONLY_INHERIT  The specific access permissions will be inherited
  161. //                              and applied to sub containers created within the
  162. //                              container, and will be applied to the container
  163. //                              itself.
  164. // SUB_OBJECTS_ONLY_INHERIT     The specific access permissions will only be inherited
  165. //                              by objects created within the specific container.
  166. //                              The access permissions will not be applied to the
  167. //                              container itself.
  168. // SUB_CONTAINERS_AND_OBJECTS_INHERIT   The specific access permissions will be
  169. //                                      inherited by containers created within the
  170. //                                      specific container, will be applied to
  171. //                                      objects created within the container, but
  172. //                                      will not be applied to the container itself.
  173. //
  174. #define NO_INHERITANCE 0x0
  175. #define SUB_CONTAINERS_ONLY_INHERIT  0x2
  176. #define SUB_OBJECTS_ONLY_INHERIT  0x1
  177. #define SUB_CONTAINERS_AND_OBJECTS_INHERIT 0x3
  178.  
  179.  
  180. //
  181. // Definition:
  182. // This enumerated type defines the objects supported by the get/set API within
  183. // this document.  See section 3.1, Object Types for a detailed definition of the
  184. // supported object types, and their name formats.
  185. //
  186. typedef enum _SE_OBJECT_TYPE
  187. {
  188.     SE_UNKNOWN_OBJECT_TYPE = 0,
  189.     SE_FILE_OBJECT,
  190.     SE_SERVICE,
  191.     SE_PRINTER,
  192.     SE_REGISTRY_KEY,
  193.     SE_LMSHARE,
  194.     SE_KERNEL_OBJECT,
  195.     SE_WINDOW_OBJECT
  196. } SE_OBJECT_TYPE;
  197.  
  198.  
  199. //
  200. // Definition: EXPLICIT_ACCESS
  201. // This structure is used to pass access control entry information into and out
  202. // of the system using the API defined in this document.
  203. // grfAccessPermissions - This contains the access permissions to assign for the
  204. //                     trustee.  It is in the form of an NT access mask.
  205. // grfAccessMode - This field defines how the permissions are to be applied for
  206. //                 the trustee.
  207. // grfInheritance - For containers, this field defines how the access control
  208. //                  entry is/(is requested) to be inherited on
  209. //                  objects/sub-containers created within the container.
  210. // Trustee - This field contains the definition of the trustee account the
  211. //           explicit access applies to.
  212. //
  213. typedef struct _EXPLICIT_ACCESS_W
  214. {
  215.     DWORD        grfAccessPermissions;
  216.     ACCESS_MODE  grfAccessMode;
  217.     DWORD        grfInheritance;
  218.     TRUSTEE_W    Trustee;
  219. } EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W;
  220.  
  221. typedef struct _EXPLICIT_ACCESS_A
  222. {
  223.     DWORD        grfAccessPermissions;
  224.     ACCESS_MODE  grfAccessMode;
  225.     DWORD        grfInheritance;
  226.     TRUSTEE_A    Trustee;
  227. } EXPLICIT_ACCESS_A, *PEXPLICIT_ACCESS_A;
  228.  
  229. #ifdef UNICODE
  230.     #define EXPLICIT_ACCESS     EXPLICIT_ACCESS_W
  231.     #define PEXPLICIT_ACCESS    PEXPLICIT_ACCESS_W
  232. #else
  233.     #define EXPLICIT_ACCESS     EXPLICIT_ACCESS_A
  234.     #define PEXPLICIT_ACCESS    PEXPLICIT_ACCESS_A
  235. #endif
  236.  
  237. #pragma option pop
  238. #endif // __ACCESS_CONTROL__
  239.